﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;


using efish.Framework.Model;
using efish.Framework.Service;

public partial class service_latestnews : efish.Framework.Web.BasePage
{
    private INewsService _newsService;
    public INewsService NewsService
    {
        get
        {
            return _newsService;
        }
        set
        {
            _newsService = value;
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            RefreshData();
            this.DataBind();
        }
    }

    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int index = Int32.Parse(GridView1.Rows[e.RowIndex].Cells[1].Text);
        //_newsService.DeleteUserByID(index);

        RefreshData();
        this.DataBind();
    }

    private void RefreshData()
    {
        this.GridView1.DataSource = _newsService.GetNewss();
    }
}
